home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
101-125
/
118
/
empire
/
src
/
source.zoo
/
cmd_edit.d
next >
Wrap
Text File
|
1987-12-02
|
24KB
|
818 lines
#empire.g
#empfunc.g
/*
* examineCountry - part of cmd_examine
*/
proc examineCountry(uint who)void:
*Country_t c;
uint i, col;
c := &Country[who];
writeln(Chout;
"c_centerRow = ", c*.c_centerRow,
", c_centerCol = ", c*.c_centerCol,
", c_techLevel = ", c*.c_techLevel,
", c_resLevel = ", c*.c_resLevel);
write(Chout;
"c_sectorCount = ", c*.c_sectorCount, ", c_money = ", c*.c_money,
", c_btu = ", c*.c_btu, ", c_last = ");
writeDate(c*.c_last);
writeln(Chout;);
writeln(Chout;
", c_timer = ", c*.c_timer,
", c_status = ", c*.c_status - cs_deity,
", c_name = ", &c*.c_name[0],
", c_password = ", &c*.c_password[0]);
write(Chout; "c_realms: ");
for i from 0 upto REALM_MAX - 1 do
write(Chout; i, " = (",
c*.c_realms[i].r_top, ':', c*.c_realms[i].r_bottom, ',',
c*.c_realms[i].r_left, ':', c*.c_realms[i].r_right, ") ");
od;
writeln(Chout;);
writeln(Chout;
"c_telegramsNew = ", c*.c_telegramsNew,
", c_telegramsTail = ", c*.c_telegramsTail,
", c_relations = ");
for i from 0 upto World.w_currCountries - 1 do
write(Chout;
case c*.c_relations[i]
incase r_neutral:
'n'
incase r_allied:
'a'
incase r_war:
'w'
esac,
" "
);
od;
writeln(Chout;);
write(Chout; "c_fleets: ");
col := 11;
for i from 0 upto 26 + 26 - 1 do
if c*.c_fleets[i] ~= NO_FLEET then
if col > 73 then
writeln(Chout;);
writeln(Chout; " ");
col := 11;
fi;
write(Chout;
("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +i)*,
':', c*.c_fleets[i], ' ');
fi;
od;
writeln(Chout;);
corp;
/*
* examineSector - part of cmd_examine
*/
proc examineSector(int r, c)void:
Sector_t s;
ItemType_t it;
readSector(r, c, s);
write(Chout; "Sector ", r, ',', c, " - ", SectorChar[s.s_type],
": lastUpdate = ");
writeDate(s.s_lastUpdate);
writeln(Chout; ", owner = ", s.s_owner);
writeln(Chout;
"iron = ", s.s_iron, ", gold = ", s.s_gold,
", checkPoint = ", s.s_checkPoint,
", type = ", SectorChar[s.s_type],
", shipCount = ", s.s_shipCount);
writeln(Chout;
"production = ", s.s_production,
", mobility = ", s.s_mobility,
", efficiency = ", s.s_efficiency);
writeln(Chout;
"plagueStage = ", s.s_plagueStage,
", plagueTime = ", s.s_plagueTime,
", defender = ", s.s_defender : x : -2,
", price = ", s.s_price);
for it from it_first upto it_last do
writeln(Chout; getItemName(it), ": quantity ", s.s_quantity[it],
", direction ", s.s_direction[it],
", threshold ", s.s_threshold[it]);
od;
corp;
/*
* examineShip - part of cmd_examine
*/
proc examineShip(uint shipNumber)void:
Ship_t ship;
readShip(shipNumber, ship);
write(Chout; "Ship \#", shipNumber, " (", getShipName(ship.sh_type),
"): lastUpdate = ");
writeDate(ship.sh_lastUpdate);
writeln(Chout; ", owner = ", ship.sh_owner);
writeln(Chout; "price = ", ship.sh_price,
", fleet = ", ship.sh_fleet,
", at ", ship.sh_row, ',', ship.sh_col,
", effic = ", ship.sh_efficiency,
", mobil = ", ship.sh_mobility);
writeln(Chout; "crew = ", ship.sh_crew,
", shells = ", ship.sh_shells,
", guns = ", ship.sh_guns,
", planes = ", ship.sh_planes,
", ore = ", ship.sh_ore,
", bars = ", ship.sh_bars);
corp;
/*
* examineFleet - part of cmd_examine.
*/
proc examineFleet(uint fleetNumber)void:
Fleet_t fleet;
uint i;
readFleet(fleetNumber, fleet);
if fleet.f_count = 0 then
writeln(Chout; "No ships in fleet \#", fleetNumber);
else
write(Chout; "Ships in fleet \#", fleetNumber, ": ");
for i from 0 upto fleet.f_count - 1 do
write(Chout; fleet.f_ship[i]);
if i ~= fleet.f_count - 1 then
write(Chout; '/');
fi;
od;
writeln(Chout;);
fi;
corp;
/*
* examineLoan - part of cmd_examine.
*/
proc examineLoan(uint loanNumber)void:
Loan_t loan;
readLoan(loanNumber, loan);
writeln("Loan \#", loanNumber, " offered by ",
&Country[loan.l_loaner].c_name[0], " to ",
&Country[loan.l_loanee].c_name[0]);
write("lastPay = ");
writeDate(loan.l_lastPay);
write(", dueDate = ");
writeDate(loan.l_dueDate);
writeln();
writeln("amount = ", loan.l_amount, ", paid = ", loan.l_paid,
", duration = ", loan.l_duration, ", rate = ", loan.l_rate,
", state = ",
case loan.l_state
incase l_offered:
"offered"
incase l_declined:
"declined"
incase l_outstanding:
"outstanding"
incase l_paidUp:
"paid up"
esac);
corp;
/*
* examineWorld - part of cmd_examine.
*/
proc examineWorld()void:
writeln(Chout; "World is ", World.w_rows, " rows by ", World.w_columns,
" columns, with ", World.w_currCountries, " out of ",
World.w_maxCountries, " users.");
writeln(Chout; "Maximum daily connect time = ", World.w_maxConnect / 30,
" half-hours.");
writeln(Chout; "Country creation password: ", &World.w_password[0]);
writeln(Chout; "Next loan: ", World.w_loanNext,
", next treaty: ", World.w_treatyNext,
", next offer: ", World.w_offerNext,
", next ship: ", World.w_shipNext);
writeln(Chout; "Weather: hiRowInc = ", World.w_hiRowInc,
", hiColInc = ", World.w_hiColInc,
", loRowInc = ", World.w_loRowInc,
", loColInc = ", World.w_loColInc);
writeln(Chout; " hiRow = ", World.w_hiRow,
", hiCol = ", World.w_hiCol,
", loRow = ", World.w_loRow,
", loCol = ", World.w_loCol);
writeln(Chout; " hiPressure = ", World.w_hiPressure,
", loPressure = ", World.w_loPressure);
corp;
proc cmd_examine()void:
uint what, n;
int r, c;
if ThisCountryNumber = DEITY then
if reqChoice(&what, "country\esector\eship\efleet\eloan\eworld\e",
"Examine what (country/sector/ship/fleet/loan/world)? ") then
skipBlanks();
case what
incase 0:
if reqCountry(&n, "Examine which country? ") then
examineCountry(n);
fi;
incase 1:
if reqSector(&r, &c, "Examine which sector? ") then
examineSector(r, c);
fi;
incase 2:
if reqShip(&n, "Examine which ship? ") then
examineShip(n);
fi;
incase 3:
if World.w_fleetNext = 0 then
err("there are no fleets yet");
else
if reqPosRange(&n, World.w_fleetNext - 1,
"Examine which fleet? ") then
examineFleet(n);
fi;
fi;
incase 4:
if World.w_loanNext = 0 then
err("there are no loans yet");
else
if reqPosRange(&n, World.w_loanNext - 1,
"Examine which loan? ") then
examineLoan(n);
fi;
fi;
incase 5:
examineWorld();
esac;
fi;
else
err("only god can examine things");
fi;
corp;
/*
* repNum - request a replacement for a numeric value.
*/
proc repNum(int oldValue, minValue, maxValue; *char prompt)int:
int n;
[100] char promptBuffer;
channel output text promptChannel;
open(promptChannel, &promptBuffer[0]);
write(promptChannel; prompt, " (", minValue, " - ", maxValue, "): ");
close(promptChannel);
writeln(Chout; &promptBuffer[0], oldValue);
while
write(Chout; &promptBuffer[0]);
if readLine(&InputBuffer[0], INPUT_LENGTH) then
InputPtr := &InputBuffer[0];
skipBlanks();
if InputPtr* ~= '\e' then
if getNumber(&n) then
if n < minValue then
err("value too small");
true
elif n > maxValue then
err("value too large");
true
else
false
fi
else
true
fi
else
n := oldValue;
false
fi
else
n := oldValue;
pretend(ioerror(Chin), void);
false
fi
do
od;
n
corp;
/*
* repScale - replace a scale factor that can be 10 - 1000.
*/
proc repScale(*uint pNum; *char prompt)void:
pNum* := repNum(pNum*, 1, 1000, prompt);
corp;
/*
* repMob - replace a mobility - value 0 - 100.
*/
proc repMob(*uint pCost; *char name)void:
pCost* := repNum(pCost*, 0, 100, name);
corp;
/*
* repCost - replace a cost - value is 10 - 128.
*/
proc repCost(*uint pCost; *char prompt)void:
pCost* := repNum(pCost*, 10, 128, prompt);
corp;
/*
* repRand - replace a base/rand pair.
*/
proc repRand(*uint pBase, pRand; *char what)void:
[50] char buffer;
channel output text promptChannel;
open(promptChannel, &buffer[0]);
write(promptChannel; what, " base");
close(promptChannel);
pBase* := repNum(pBase*, 0, 127, &buffer[0]);
open(promptChannel, &buffer[0]);
write(promptChannel; what, " rand");
close(promptChannel);
pRand* := repNum(pRand*, 1, 128, &buffer[0]);
corp;
/*
* editCountry - part of cmd_edit
*/
proc editCountry(uint who)void:
*Country_t c;
c := &Country[who];
c*.c_status := repNum(c*.c_status - cs_deity, 0, 4, "Status") + cs_deity;
c*.c_sectorCount := repNum(c*.c_sectorCount, 0, 0x7fff, "Sector count");
c*.c_techLevel := repNum(c*.c_techLevel, 0, 0x7fff, "Technology level");
c*.c_resLevel := repNum(c*.c_resLevel, 0, 0x7fff, "Research level");
c*.c_money := repNum(c*.c_money, 0, 0x7fff, "Money");
c*.c_btu := repNum(c*.c_btu, 0, BTU_MAX, "BTU's");
c*.c_timer :=
repNum(c*.c_timer, 0, World.w_maxConnect, "Remaining play time");
c*.c_centerRow := repNum(c*.c_centerRow,
-World.w_rows, World.w_rows - 1, "center row");
c*.c_centerCol := repNum(c*.c_centerCol,
-World.w_columns, World.w_columns - 1, "center column");
corp;
/*
* editSector - part of cmd_edit
*/
proc editSector(int r, c)void:
Sector_t s;
ItemType_t it;
readSector(r, c, s);
write(Chout; "Sector ", r, ',', c, " - ", SectorChar[s.s_type],
" lastUpdate = ");
writeDate(s.s_lastUpdate);
writeln(Chout;);
s.s_owner := repNum(s.s_owner, 0, World.w_currCountries, "Owner");
s.s_iron := repNum(s.s_iron, 0, 127, "Mineral sample");
s.s_gold := repNum(s.s_gold,0,127,"Gold sample");
s.s_checkPoint := repNum(s.s_checkPoint, -128, 127, "Checkpoint code");
s.s_shipCount := repNum(s.s_shipCount, 0, 32767, "Ship count");
s.s_production := repNum(s.s_production, 0, 127, "Production units");
s.s_mobility := repNum(s.s_mobility, 0, 127, "Mobility ");
s.s_efficiency := repNum(s.s_efficiency, 0, 100, "Efficiency");
s.s_plagueStage := repNum(s.s_plagueStage, 0, 4, "Plague stage");
s.s_plagueTime := repNum(s.s_plagueTime, 0, 127, "Plague time");
s.s_price := repNum(s.s_price, 0, 127, "Contract price");
for it from it_first upto it_last do
writeQuan(s, it, repNum(readQuan(s, it), 0, 1270, getItemName(it)));
od;
writeSector(r, c, s);
corp;
/*
* editShip - part of cmd_edit
*/
proc editShip(uint shipNumber)void:
Ship_t ship;
readShip(shipNumber, ship);
write(Chout; "Ship \#", shipNumber, " (", getShipName(ship.sh_type),
" in fleet ", ship.sh_fleet, "): lastUpdate = ");
writeDate(ship.sh_lastUpdate);
writeln(Chout;);
ship.sh_owner :=
repNum(ship.sh_owner, 0, World.w_currCountries - 1, "Owner");
ship.sh_price := repNum(ship.sh_price, 0, 127, "Price");
ship.sh_efficiency := repNum(ship.sh_efficiency, 0, 100, "Efficiency");
ship.sh_mobility := repNum(ship.sh_mobility, -128, 127, "Mobility");
ship.sh_row := repNum(ship.sh_row, 0, World.w_rows - 1, "Current row");
ship.sh_col := repNum(ship.sh_col, 0, World.w_columns - 1, "Current col");
ship.sh_crew := repNum(ship.sh_crew, 0, 127, "Crew");
ship.sh_shells := repNum(ship.sh_shells, 0, 127, "Shells");
ship.sh_guns := repNum(ship.sh_guns, 0, 127, "Guns");
ship.sh_planes := repNum(ship.sh_planes, 0, 127, "Planes");
ship.sh_ore := repNum(ship.sh_ore, 0, 127, "Ore");
ship.sh_bars := repNum(ship.sh_bars, 0, 127, "Bars");
writeShip(shipNumber, ship);
corp;
/*
* editWorld - part of cmd_edit.
*/
proc editWorld()void:
World.w_maxCountries :=
repNum(World.w_maxCountries, 2, 9, "Maximum \# users");
World.w_currCountries :=
repNum(World.w_currCountries, 0, 9, "Current \# users");
World.w_maxConnect := repNum(World.w_maxConnect / 30, 1, 6,
"Maximum connect time in half-hours") * 30;
World.w_loanNext := repNum(World.w_loanNext, 0, 32767, "Next loan");
World.w_treatyNext := repNum(World.w_treatyNext, 0, 32767, "Next treaty");
World.w_offerNext := repNum(World.w_offerNext, 0, 32767, "Next offer");
World.w_shipNext := repNum(World.w_shipNext, 0, 32767, "Next ship");
World.w_fleetNext := repNum(World.w_fleetNext, 0, 32767, "Next fleet");
corp;
/*
* editWeather - part of cmd_edit.
*/
proc editWeather()void:
World.w_hiRowInc := repNum(World.w_hiRowInc, -4, +4, "hiRowInc");
World.w_hiColInc := repNum(World.w_hiColInc, -4, +4, "hiColInc");
World.w_loRowInc := repNum(World.w_loRowInc, -4, +4, "loRowInc");
World.w_loColInc := repNum(World.w_loColInc, -4, +4, "loColInc");
World.w_hiRow := repNum(World.w_hiRow, 0, World.w_rows * 4 - 1, "hiRow");
World.w_hiCol := repNum(World.w_hiCol, 0, World.w_columns * 4 - 1,
"hiCol");
World.w_loRow := repNum(World.w_loRow, 0, World.w_rows * 4 - 1, "loRow");
World.w_loCol := repNum(World.w_loCol, 0, World.w_columns * 4 - 1,
"loCol");
World.w_hiMin := repNum(World.w_hiMin, 0, 20, "hiMin");
World.w_hiMax := repNum(World.w_hiMax, 0, 20, "hiMax");
World.w_loMin := repNum(World.w_loMin, -20, 0, "loMin");
World.w_loMax := repNum(World.w_loMax, -20, 0, "loMax");
World.w_hiPressure := repNum(World.w_hiPressure, World.w_hiMin,
World.w_hiMax, "hiPressure");
World.w_loPressure := repNum(World.w_loPressure, World.w_loMin,
World.w_loMax, "loPressure");
corp;
/*
* editProduction - part of cmd_edit.
*/
proc editProduction()void:
World.w_resCost := repNum(World.w_resCost, 0, 127, "research cost");
World.w_techCost := repNum(World.w_techCost, 0, 127, "technology cost");
World.w_gunCost := repNum(World.w_gunCost, 0, 127, "gun cost");
World.w_shellCost := repNum(World.w_shellCost, 0, 127, "shell cost");
World.w_planeCost := repNum(World.w_planeCost, 0, 127, "plane cost");
World.w_barCost := repNum(World.w_barCost, 0, 127, "bar cost");
corp;
/*
* editMobilities - part of cmd_edit.
*/
proc editMobilities()void:
uint i, j;
[100] char promptBuffer;
channel output text promptChannel;
repMob(&World.w_mountMob, "mountMob");
repMob(&World.w_wildMob, "wildMob");
repMob(&World.w_defMob, "defMob");
repMob(&World.w_civMob, "civMob");
repMob(&World.w_milMob, "milMob");
repMob(&World.w_shellMob, "shellMob");
repMob(&World.w_gunMob, "gunMob");
repMob(&World.w_planeMob, "planeMob");
repMob(&World.w_oreMob, "oreMob");
repMob(&World.w_barMob, "barMob");
for i from 0 upto 3 do
for j from 0 upto 3 do
open(promptChannel, &promptBuffer[0]);
write(promptChannel; "Cost of attack from ",
case i
incase 0:
"highway"
incase 1:
"regular"
incase 2:
"wilderness"
incase 3:
"mountain"
esac,
" to ",
case j
incase 0:
"highway"
incase 1:
"regular"
incase 2:
"wilderness"
incase 3:
"mountain"
esac);
close(promptChannel);
World.w_attackMobilityCost[i, j] :=
repNum(World.w_attackMobilityCost[i, j], 0, 32767,
&promptBuffer[0]);
od;
od;
corp;
/*
* editPlague - part of cmd_edit.
*/
proc editPlague()void:
World.w_plagueKiller := repNum(World.w_plagueKiller,
0, 2270, "plagueKiller");
repScale(&World.w_plagueBooster, "plagueBooster");
repRand(&World.w_plagueOneBase,
&World.w_plagueOneRand, "plague stage one");
repRand(&World.w_plagueTwoBase,
&World.w_plagueTwoRand, "plague stage two");
repRand(&World.w_plagueThreeBase, &World.w_plagueThreeRand,
"plague stage three");
corp;
/*
* editCosts - edit various costs. (part of cmd_edit)
*/
proc editCosts()void:
World.w_efficCost := repNum(World.w_efficCost, 0, 1000, "efficCost");
World.w_milSuppliesCost := repNum(World.w_milSuppliesCost,
0, 800, "milSuppliesCost");
World.w_utilityRate := repNum(World.w_utilityRate, 0, 100, "utilityRate");
World.w_interestRate :=
repNum(World.w_interestRate, 0, 200, "interestRate");
World.w_bridgeCost := repNum(World.w_bridgeCost, 0, 32767, "bridge cost");
World.w_shipCostMult :=
repNum(World.w_shipCostMult, 0, 100, "shipCostMult");
corp;
/*
* editScales - part of cmd_edit.
*/
proc editScales()void:
repScale(&World.w_resScale, "resScale");
repScale(&World.w_techScale, "techScale");
repScale(&World.w_defenseScale, "defenseScale");
repScale(&World.w_shellScale, "shellScale");
repScale(&World.w_airportScale, "airportScale");
repScale(&World.w_harborScale, "harborScale");
repScale(&World.w_bridgeScale, "bridgeScale");
repScale(&World.w_goldScale, "goldScale");
repScale(&World.w_ironScale, "ironScale");
repScale(&World.w_shipWorkScale, "shipWorkScale");
corp;
/*
* editUpdates - part of cmd_edit.
*/
proc editUpdates()void:
repScale(&World.w_efficScale, "efficScale");
repScale(&World.w_mobilScale, "mobilScale");
repScale(&World.w_urbanGrowthFactor, "urbanGrowthFactor");
World.w_bridgeDieFactor := repNum(World.w_bridgeDieFactor,
10, 4000, "bridgeDieFactor");
World.w_highGrowthFactor := repNum(World.w_highGrowthFactor,
10, 2000, "highGrowthFactor");
World.w_lowGrowthFactor := repNum(World.w_lowGrowthFactor,
10, 4000, "lowGrowthFactor");
World.w_BTUDivisor := repNum(World.w_BTUDivisor,
500, 32767, "BTUDivisor");
World.w_resDecreaser := repNum(World.w_resDecreaser,
480, 32767, "resDecreaser");
World.w_techDecreaser := repNum(World.w_techDecreaser,
480, 32767, "techDecreaser");
repRand(&World.w_hurricaneLandBase, &World.w_hurricaneLandRand,
"hurricane land");
repRand(&World.w_hurricaneSeaBase, &World.w_hurricaneSeaRand,
"hurricane sea");
corp;
/*
* editFighting - part of cmd_edit.
*/
proc editFighting()void:
World.w_assFortAdv := repNum(World.w_assFortAdv, 1, 10, "assFortAdv");
World.w_assCapAdv := repNum(World.w_assCapAdv, 1, 10, "assCapAdv");
World.w_assBankAdv := repNum(World.w_assBankAdv, 1, 10, "assBankAdv");
World.w_attFortAdv := repNum(World.w_attFortAdv, 1, 10, "attFortAdv");
World.w_attCapAdv := repNum(World.w_attCapAdv, 1, 10, "attCapAdv");
World.w_attBankAdv := repNum(World.w_attBankAdv, 1, 10, "attBankAdv");
World.w_assAdv := repNum(World.w_assAdv, 0, 1000, "assAdv");
World.w_fortAdv := repNum(World.w_fortAdv, 0, 10, "fortAdv");
World.w_boardAdv := repNum(World.w_boardAdv, 0, 10000, "boardAdv");
corp;
/*
* editSea - part of cmd_edit.
*/
proc editSea()void:
World.w_torpCost := repNum(World.w_torpCost, 0, 10, "torpCost");
World.w_torpMobCost := repNum(World.w_torpMobCost, 0, 127, "torpMobCost");
World.w_torpRange := repNum(World.w_torpRange, 0, 25, "torpRange");
World.w_torpAcc0 := repNum(World.w_torpAcc0, 0, 100, "torpAcc0");
World.w_torpAcc1 := repNum(World.w_torpAcc1, 0, 100, "torpAcc1");
World.w_torpAcc2 := repNum(World.w_torpAcc2, 0, 100, "torpAcc2");
World.w_torpAcc3 := repNum(World.w_torpAcc3, 0, 100, "torpAcc3");
repRand(&World.w_torpBase, &World.w_torpRand, "torpedo damage");
World.w_chargeCost := repNum(World.w_chargeCost, 0, 10, "chargeCost");
World.w_chargeMobCost := repNum(World.w_chargeMobCost, 0, 127,
"chargeMobCost");
repRand(&World.w_chargeBase, &World.w_chargeRand, "depth charge damage");
repRand(&World.w_mineBase, &World.w_mineRand, "mine damage");
corp;
/*
* editAir - part of cmd_edit.
*/
proc editAir()void:
World.w_fuelTankSize := repNum(World.w_fuelTankSize,
0, 500, "fuelTankSize");
World.w_fuelRichness := repNum(World.w_fuelRichness,
0, 400, "fuelRichness");
World.w_flakFactor := repNum(World.w_flakFactor, 1, 100, "flakFactor");
repScale(&World.w_landScale, "landScale");
repRand(&World.w_bombBase, &World.w_bombRand, "bomb damage");
repRand(&World.w_planeBase, &World.w_planeRand, "crashing plane damage");
corp;
/*
* editMisc - part of cmd_edit.
*/
proc editMisc()void:
repScale(&World.w_contractScale, "contractScale");
World.w_deathFactor := repNum(World.w_deathFactor, 0, 500, "deathFactor");
World.w_gunMax := repNum(World.w_gunMax, 1, 20, "gunMax");
repScale(&World.w_rangeDivisor, "rangeDivisor");
repScale(&World.w_gunScale, "gunScale");
World.w_lookShipFact := repNum(World.w_lookShipFact,
10, 32767, "lookShipFact");
repScale(&World.w_collectScale, "collectScale");
repScale(&World.w_radarFactor, "radarFactor");
World.w_spyFactor := repNum(World.w_spyFactor, 1, 1000, "spyFactor");
corp;
/*
* repNaval - replace values in a naval array.
*/
proc repNaval(*[range(ShipType_t)] uint pArray; *char what;
uint minVal, maxVal)void:
channel output text promptChannel;
[100] char promptBuffer;
ShipType_t st;
for st from st_first upto st_last do
open(promptChannel, &promptBuffer[0]);
write(promptChannel; what, " of ", getShipName(st));
close(promptChannel);
pArray*[st] := repNum(pArray*[st], minVal, maxVal, &promptBuffer[0]);
od;
corp;
/*
* editNaval - edit ship parameters.
*/
proc editNaval()void:
[50] char buff;
channel output text promptChannel;
uint what;
ItemType_t it;
if reqChoice(&what,
"cost\esize\elrange\eshrange\ecapacity\espeed\edamage\e",
"Edit what (cost/size/lrange/shrange/capacity/speed/damage)? "
) then
case what
incase 0:
repNaval(&World.w_shipCost, "cost", 0, 128);
incase 1:
repNaval(&World.w_shipSize, "size", 0, 1000);
incase 2:
repNaval(&World.w_shipRange, "lookout range", 0, 1000);
incase 3:
repNaval(&World.w_shipShRange, "shelling range", 0, 1000);
incase 4:
for it from it_first upto it_last do
open(promptChannel, &buff[0]);
write(promptChannel; getItemName(it), " capacity");
close(promptChannel);
repNaval(&World.w_shipCapacity[it], &buff[0], 0, 127);
od;
incase 5:
repNaval(&World.w_shipSpeed, "mobility cost", 0, 10000);
incase 6:
repNaval(&World.w_shipDamage, "relative damage", 0, 10);
esac;
fi;
corp;
proc cmd_edit()void:
uint what, n;
int r, c;
if ThisCountryNumber = DEITY then
if reqChoice(&what,
"country\e"
"sector\e"
"ship\e"
"world\e"
"weather\e"
"production\e"
"mobilities\e"
"plague\e"
"costs\e"
"scales\e"
"updates\e"
"fighting\e"
"sea\e"
"air\e"
"miscellaneous\e"
"naval\e",
"Edit what (cou/sec/sh/wo/we/pr/mo/pl/cos/sc/up/fi/sea/ai/mi/na)? "
) then
skipBlanks();
case what
incase 0:
if reqCountry(&n, "Edit which country? ") then
editCountry(n);
fi;
incase 1:
if reqSector(&r, &c, "Edit which sector? ") then
editSector(r, c);
fi;
incase 2:
if reqShip(&n, "Edit which ship? ") then
editShip(n);
fi;
incase 3:
editWorld();
incase 4:
editWeather();
incase 5:
editProduction();
incase 6:
editMobilities();
incase 7:
editPlague();
incase 8:
editCosts();
incase 9:
editScales();
incase 10:
editUpdates();
incase 11:
editFighting();
incase 12:
editSea();
incase 13:
editAir();
incase 14:
editMisc();
incase 15:
editNaval();
esac;
fi;
else
err("only god can edit things");
fi;
corp;